﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.EShop.Bll;
using Runda.EShop.Common.Utility;

namespace Runda.EShop.Web.Shared
{
    public partial class ChangePassword : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            SystemBll bll = new SystemBll();

            OperateResult result = bll.ChangePassword(base.User.Identity.LoginUser.UserID
                , System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtOldPwd.Text.Trim(), "MD5")
                , System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPwd.Text.Trim(), "MD5")
                );
            if (! result.IsSuccess)
            {
                //lblMessage.Text = result.ErrorMessage;
                ClientScript.RegisterStartupScript(this.GetType(), "success", "alert('" + result.Message + "!');", true);
                return;
            }
            ClientScript.RegisterStartupScript(this.GetType(), "success", "alert('密码修改成功.');", true);
        }
    }
}